package com.app.controller;

import com.app.model.MerchantsModel;
import com.app.service.MerchantsService;
import com.app.util.Result;
import com.app.vo.MerchantsModelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
//招商引资API
@Controller
@RestController
@RequestMapping("/api/merchants")
public class MerchantsController {

    @Autowired
    private MerchantsService merchantsService;

    //招商引资查询所有
    @GetMapping("/getMerchantsList")
    public Result<Object> getMerchantsList(@RequestParam(defaultValue = "0") Integer page,
                                           @RequestParam(defaultValue = "10") Integer limit) {
        MerchantsModelVo merchantsList = merchantsService.getMerchantsList(page, limit);
        return Result.success(merchantsList);
    }

    //招商引资查询详情
    @GetMapping("/getMerchants")
    public Result<Object> getMerchants(@RequestParam Integer id) {
        MerchantsModel merchants = merchantsService.getMerchants(id);
        return Result.success(merchants);
    }
}
